/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import Model.Board;
import View.About;
import View.BoardInterface;
import View.ChooseMode;
import View.Creater;
import View.GameInterface;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;

/**
 *
 * @author Long
 */
public class GameUIListener extends Controller implements ActionListener {

    public GameUIListener(BoardInterface boardInterface, Board board, GameInterface gameInterface, ChooseMode chooseMode, Creater creater) {
        super(boardInterface, board, gameInterface, chooseMode, creater);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == gameInterface.getSinglePlayerButton()) {
            numberOfModule = 1;
            boardInterface.setPlayer1Name("Bạn");
            boardInterface.setPlayer2Name("Máy tính ");
            boardInterface.setPlayer1Icon(iconTurn);
            boardInterface.setLocationRelativeTo(null);
            boardInterface.setVisible(true);
            gameInterface.setVisible(false);

        }
        if (e.getSource() == gameInterface.getMultiPlayerButton()) {
            gameInterface.setVisible(false);
            chooseMode.setLocationRelativeTo(null);
            chooseMode.setVisible(true);
        }
        if(e.getSource() ==gameInterface.getSettingButton()){
         JOptionPane.showMessageDialog(null, "không hỗ trợ tính năng này");
        }
        if (e.getSource() == gameInterface.getAboutButton()) {
            About about = new About();
            about.setVisible(true);
        }
        if(e.getSource() == gameInterface.getExitButton()){
        System.exit(0);
        }
    }
}
